package org.luckystrophe.snowtoms.model.impl;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.luckystrophe.snowtoms.R;
import org.luckystrophe.snowtoms.model.JsonRequestPOST;
import org.luckystrophe.snowtoms.pref.UserPreference_;

import com.googlecode.androidannotations.annotations.EBean;
import com.googlecode.androidannotations.annotations.res.StringRes;
import com.googlecode.androidannotations.annotations.sharedpreferences.Pref;

@EBean
public class GetRankRequest extends JsonRequestPOST {

	@Pref
	UserPreference_ pref;

	@StringRes(R.string.api_method_getRankingRequest)
	String apiMethod;

	@Override
	public JSONObject getBody() throws JSONException {
		JSONObject jo = new JSONObject();
		jo.put("method", apiMethod);
		return jo;
	}

	public JSONArray parseResultJson(JSONObject resultJson) throws JSONException {
		JSONObject jo = resultJson.getJSONObject("params");
		JSONArray districtJsonArray = jo.getJSONArray("guList");
		return districtJsonArray;
	}
}
